package com.niuquan.base_data;

import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

public class Messages {
	private String type = null;
	private ArrayList<BasicNameValuePair> list;
	public Messages(String type,ArrayList<BasicNameValuePair> list)
	{
		this.list = list;
		this.type = type;
	}
	
	public Messages(ArrayList<BasicNameValuePair> list)
	{
		this.list = list;
	}
	
	public String tojstring()
	{
		JSONObject jobject = new JSONObject();
		String res = null;
		try {
			for(BasicNameValuePair one : list)
			{
				jobject.put(one.getName(), one.getValue());
			}
			res = jobject.toString();
		} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
		}
		return res;
	}
}
